package com.example.yan.java方法;

public class MainClass3 {
    public static long fibonacci(long number) {
        if ((number == 0) || (number == 1))
            return number;
        else
            return fibonacci(number - 1) + fibonacci(number - 2);
    }
    public static void main(String[] args) {
        Integer i=10; //斐波那契数
        for (int counter = 0; counter <= i; counter++){
            System.out.printf("Fibonacci of %d is: %d\n",
                    counter, fibonacci(counter));
        }
    }
}
